﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UC_GiaPhong_TheoGio_Edit.ascx.cs" Inherits="QuanLyKhachSan.UC_GiaPhong_TheoGio_Edit" %>
<%@ Register Assembly="Telerik.Web.UI, Version=2011.2.712.35, Culture=neutral, PublicKeyToken=121FAE78165BA3D4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<style type="text/css">
    .style1
    {
        font-family: Tahoma;
        font-size: 12px;
        width: 70px;
    }
</style>
<table width="100%">
    <tr>
        <td class="style1">
            <asp:Label ID="lblGio" runat="server" Text="Giờ"></asp:Label>
        </td>
        <td>
            <telerik:RadNumericTextBox ID="txtGio" runat="server" Type="Number" EmptyMessage="Nhập giờ" Width="150" >
            </telerik:RadNumericTextBox>
        </td>
    </tr>
    <tr>
        <td class="style1">
            <asp:Label ID="Label2" runat="server" Text="Cách tính"></asp:Label>
        </td>
        <td>
            <telerik:RadComboBox ID="cbxCachTinh" runat="server" Width="155" OnClientSelectedIndexChanged="OnClientSelectedIndexChangedEventHandler">
                <Items>
                    <telerik:RadComboBoxItem Value="0" Text="Giá tiền" />
                    <telerik:RadComboBoxItem Value="1" Text="Theo phần trăm" />
                </Items>
            </telerik:RadComboBox>
            <%--Chọn phần trăm thì hiện thị textbox phần trăm --%>
            <script type="text/javascript" language="javascript">
                function OnClientSelectedIndexChangedEventHandler(sender, args) {
                    try {
                        var item = args.get_item().get_value();
                        var cbxLoaiGia = $find('<%= cbxLoaiGia.ClientID %>');
                        var comboItems = cbxLoaiGia.get_items();
                        var comboItem = comboItems.getItem(0);                        
                        if (item == "0") {
                            document.getElementById('rowPhanTram').style.display = 'none';
                            document.getElementById('rowGiaTien').style.display = '';
                            comboItem.enable();
                        }
                        else {
                            document.getElementById('rowPhanTram').style.display = '';
                            document.getElementById('rowGiaTien').style.display = 'none';
                            comboItem.disable();
                            comboItems.getItem(1).select(); 
                        }
                    } catch (e) {
                        alert(e)
                    }
                }
            </script>
        </td>        
    </tr>
    <tr style="display:none" id="rowPhanTram">
        <td class="style1">
            <asp:Label ID="Label3" runat="server" Text="Phần trăm"></asp:Label>
        </td>
        <td>
            <telerik:RadNumericTextBox ID="txtPhanTram" runat="server" MaxValue="100" MinValue="0" Type="Percent" EmptyMessage="Nhập phần trăm" Width="150" >
            </telerik:RadNumericTextBox>
        </td>
    </tr>
    <tr id="rowGiaTien">
        <td class="style1">
            <asp:Label ID="lblGia" runat="server" Text="Giá"></asp:Label>
        </td>
        <td>
            <telerik:RadNumericTextBox ID="txtGia" runat="server" Type="Currency" MinValue="0" EmptyMessage="Nhập giá" Width="150" >
            </telerik:RadNumericTextBox>
        </td>
    </tr>
    <tr>
        <td class="style1">
            <asp:Label ID="Label1" runat="server" Text="Loại giá"></asp:Label>
        </td>
        <td>
            <telerik:RadComboBox ID="cbxLoaiGia" runat="server" Width="155">
                <Items>
                    <telerik:RadComboBoxItem  Value="GiaGoc" Text="Giá gốc" />
                    <telerik:RadComboBoxItem Value="BinhThuong" Text="Giá bình thường" />
                    <telerik:RadComboBoxItem Value="GiaCuoi" Text="Giá cuối" />
                </Items>
            </telerik:RadComboBox>
        </td>        
    </tr>
    <tr>
        <td colspan="2" align="center">            
            <table width="200px">
                <tr>
                    <td align="right">
                        <telerik:RadButton ID="cmdCancel" runat="server" Text="Cancel">
                        </telerik:RadButton>    
                    </td>
                    <td align="left">
                        <telerik:RadButton ID="cmdOK" runat="server" Text="OK" onclick="cmdOK_Click">
                        </telerik:RadButton> 
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>